package control;

import java.awt.Dimension;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Timer;
import java.util.jar.Manifest;

import javax.swing.ImageIcon;

import model.EqActiveCooling;
import model.EqCO2;
import model.EqCurtain;
import model.EqLight;
import model.EqSprinkler;
import model.EqTermostat;
import model.EqWindow;
import model.Equipment;
import model.ModelClass;
import model.Plant;
import model.Section;
import model.Variables;
import view.CenterPanel;
import view.MainF;
import view.RightPanel;

public class ActListener implements ActionListener {
	MainF mainF;
	CenterPanel centerPanel;
	ModelClass modelClass;
	Variables variables;
	FunktionMethods funktionMethods;

	public ActListener(MainF mainF) {
		this.mainF = mainF;
		this.centerPanel = mainF.getCenter();
		this.modelClass = mainF.getModel();
		this.variables = modelClass.getVariables();
		this.funktionMethods = mainF.getFunktionMethods();

	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		String ac = arg0.getActionCommand();

		if (ac.equals("Home")) {
			funktionMethods.showPanel("Houses");
		}
		if (ac.equals("ShowHomepage")) {
			funktionMethods.showPanel("CenterHomePage");
		}
		if (ac.equals("ConfigHouse")) {
			funktionMethods.showPanel("ConfigHouse");
		}
		if (ac.equals("Settings")) {
			funktionMethods.showPanel("Settings");
		}
		if (ac.equals("Add Plant")) {
			funktionMethods.showPanel("AddPlant");
		}
		if (ac.equals("NewHouse")) {
			funktionMethods.showPanel("NewHouse");
		}
		if (ac.equals("Apply")) {
			funktionMethods.showPanel("Houses");
		}
		if (ac.equals("StatsPanel")) {
			funktionMethods.showPanel("StatsPanel");
		}
		if (ac.equals("NewPlant")) {
			funktionMethods.showPanel("NewPlant");
		}
		if (ac.equals("ExpandRight")) {
			funktionMethods.expandRightPanel();
		}
		if (ac.equals("Back")) {
			funktionMethods.backward();
		}
		if (ac.equals("CreateNewHouse")) {
			funktionMethods.createNewHouse();
		}
		if (ac.equals("HouseTile")) {
			funktionMethods.houseTilePressed(arg0);
		}
		if (ac.equals("PlantTile")) {
			funktionMethods.plantTilePressed(arg0);
		}
		if (ac.equals("SectionTile")) {
			funktionMethods.sectionTilePressed(arg0);
		}
		if (ac.equals("DiscardPlants")) {
			funktionMethods.discardPlant();
		}
		if (ac.equals("SellPlants")) {
			funktionMethods.sellPlant();
		}
		if (ac.equals("AutomaticClimateControl")) {
			funktionMethods.automaticClimateControlForAllHouses();
		}
		if (ac.equals("chckSprinklers")) {
			funktionMethods.manuelOnOffSprinkler();
		}
		if (ac.equals("chckWindows")) {
			funktionMethods.manuelOpenCloseWindows();
		}
		if (ac.equals("CHAutomaticClimateControl")) {
			funktionMethods.setAutoClimateOnOffForSingleHouse();
		}
		if (ac.equals("Autogenerated")) {
			funktionMethods.autoGenerateMeasOnOff();
		}
		if (ac.equals("Create plant")) {
			funktionMethods.createNewPlant();
		}

		// CheckBoxes in Settings
		if (ac.equals("chAlarmCO2")) {
			funktionMethods.configHouseAlarmCO2();
		}
		if (ac.equals("chAlarmLight")) {
			funktionMethods.configHouseAlarmLight();
		}
		if (ac.equals("chAlarmHumi")) {
			funktionMethods.configHouseAlarmHumidity();
		}
		if (ac.equals("chAlarmTemp")) {
			funktionMethods.configHouseAlarmTemp();
		}
		if (ac.equals("chSectionEmpty")) {
			funktionMethods.configHouseSectionEmpty();
		}
		if (ac.equals("chPlantFinnished")) {
			funktionMethods.configHousePlantFinished();
		}
	}
}
